///PHILOTES Source Code.  (C)2012 PhiloLabs
#pragma once

#ifndef __ShadowTextureManager_H__
#define __ShadowTextureManager_H__

// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreSingleton.h"
#include "OgrePixelFormat.h"
#include "OgreTexture.h"
#include "OgreIteratorWrappers.h"


namespace Ogre
{
	
	
	typedef vector<TexturePtr>::type ShadowTextureList;

	
	struct ShadowTextureConfig
	{
		unsigned int width;
		unsigned int height;
		PixelFormat format;
        unsigned int fsaa;
		uint16		depthBufferPoolId;

		ShadowTextureConfig()
			: width(512), height(512), format(PF_X8R8G8B8), fsaa(0), depthBufferPoolId(1) {}
	};

	typedef vector<ShadowTextureConfig>::type ShadowTextureConfigList;
	typedef ConstVectorIterator<ShadowTextureConfigList> ConstShadowTextureConfigIterator;

	inline _OgreExport bool operator== ( const ShadowTextureConfig& lhs, const ShadowTextureConfig& rhs );
	inline _OgreExport bool operator!= ( const ShadowTextureConfig& lhs, const ShadowTextureConfig& rhs );


	
	class _OgreExport ShadowTextureManager : public Singleton<ShadowTextureManager>, public MemAlloc_SceneCtrl
	{
	protected:
		ShadowTextureList mTextureList;
		ShadowTextureList mNullTextureList;
		size_t mCount;

	public:
		ShadowTextureManager();
		virtual ~ShadowTextureManager();

		
		virtual void getShadowTextures(const ShadowTextureConfigList& config, 
			ShadowTextureList& listToPopulate);

		
		virtual TexturePtr getNullShadowTexture(PixelFormat format);

		
		virtual void clearUnused();
		
		virtual void clear();

        
        static ShadowTextureManager& getSingleton(void);
        
        static ShadowTextureManager* getSingletonPtr(void);

	};

	
	
}


#endif

